#include <bits/stdc++.h>
using namespace std;
int main(){
	string S = "abc";
	do{
		cout<<S<<endl;
	}while(next_permutation(S.begin(),S.end()));
	return 0;
}
